package cn.yunhe.util;


import cn.yunhe.entity.Field;
import cn.yunhe.entity.Question;
import cn.yunhe.entity.QuestionType;

import java.util.Date;
import java.util.List;


/**
 * List 转 Question
 * @Author liu
 */
public class ListToQuestionUtil {

    public static Question getQuestion(List<String> list){
            Question question=new Question();
            int i=1;
            for (String str:list) {
                switch (i){
                    case 1:
                        question.setName(str);
                        break;
                    case 2:
                        question.setA(str);
                        break;
                    case 3:
                        question.setB(str);
                        break;
                    case 4:
                        question.setC(str);
                        break;
                    case 5:
                        question.setD(str);
                        break;
                    case 6:
                        question.setQuestionType(new QuestionType(QuestionTypeUtil.getQuestionType(str)));
                        System.out.println(question.getQuestionType().getId()+"==========");
                        question.setAnswer(str);
                        break;
                }
                i++;
            }
            question.setCreateTime(new Date());
            question.setCreator("纳什均衡");
            Field field= new Field();
            field.setFieldId(1);
            question.setField(field);
        return question;
    }
}
